package com.moon.commonlib.api;

import okhttp3.OkHttpClient;

/**
 * Author: XuChang
 * Date: 2019/8/13 11:15
 * Description:
 * History:
 */
public class OkHttpFactory {
    static OkHttpClient okHttpClient;

    public static OkHttpClient getInstance() {
        if (okHttpClient == null) {
            synchronized (OkHttpFactory.class) {
                if (okHttpClient == null)
                    okHttpClient = getOkHttpClient();
            }
        }
        return okHttpClient;
    }

    private static OkHttpClient getOkHttpClient() {
        return new OkHttpClient.Builder()
                .addInterceptor(new RetrofitLogInterceptor())
                .build();
    }
}
